package Homework729;
/*排序sort.txt*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Collections;

public class homework01 {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new FileReader("sort.txt"));
		ArrayList<String> list=new ArrayList<>();
		String str=null;
		while((str=br.readLine())!=null){
			list.add(str);
		}
		br.close();
		Collections.sort(list);
		BufferedWriter bw=new BufferedWriter(new FileWriter("sort.txt"));
		for(String str1:list){
			bw.write(str1);
			bw.newLine();
		}
		bw.close();
	}
}
